﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Home_BanChay : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            CommonDAO cm = new CommonDAO();
            rptBanChay.DataSource =
                cm.queryForTable("select top 3 n.name,chietkhau,s.id,picurl,GiaBanThamKhao,tenHang,GiaBanCoChietKhau,HangMoi,QuaTang,conHang from sanpham s left join sanpham_nhom n on s.nhomid=n.id where banchay>0", "t");
            rptBanChay.DataBind();
        }
    }

    public string saleCheck(string salePercent, string conHang)
    {
        if (int.Parse(salePercent) > 0 && conHang=="1")
            return ("<div class='pi-sales'><div class='pis-item'>" + salePercent.ToString() + "%</div></div>");
        else
            return "";
    }
    public string giftCheck(string gift, string conHang)
    {
        if (gift != null && gift.ToString().Length > 0 && conHang == "1")
            return ("<div class='pi-sales'><div class='pis-km2'></div></div>");
        else
            return "";
    }
    public string newCheck(string isNew)
    {
        if (int.Parse(isNew) == 1)
            return ("<div align='center' class='ico_moi_small'></div>");
        else
            return "";
    }
    public string existProductCheck(string conHang)
    {
        if (conHang == "0")
            return ("<div class='pi-hethang'><div class='pis-km2'></div></div>");
        else
            return "";
    }
}
